<?php

/**
 * tache form base class.
 *
 * @method tache getObject() Returns the current form's model object
 *
 * @package    gesp
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BasetacheForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'tac_id'               => new sfWidgetFormInputHidden(),
      'tac_prj_id'           => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('projet'), 'add_empty' => false)),
      'tac_parent_id'        => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('tache_pere'), 'add_empty' => true)),
      'tac_cat_id'           => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('categorie'), 'add_empty' => false)),
      'tac_user_id'          => new sfWidgetFormInputText(),
      'tac_libelle'          => new sfWidgetFormInputText(),
      'tac_description'      => new sfWidgetFormTextarea(),
      'tac_urgence'          => new sfWidgetFormInputText(),
      'tac_date_debut'       => new sfWidgetFormDate(),
      'tac_date_echeance'    => new sfWidgetFormDate(),
      'tac_date_fin'         => new sfWidgetFormDate(),
      'tac_charge_estimee'   => new sfWidgetFormInputText(),
      'tac_charge_consommee' => new sfWidgetFormInputText(),
      'tac_charge_restante'  => new sfWidgetFormInputText(),
      'tac_etat'             => new sfWidgetFormInputText(),
      'tac_termine'          => new sfWidgetFormInputCheckbox(),
      'created_at'           => new sfWidgetFormDateTime(),
      'updated_at'           => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'tac_id'               => new sfValidatorChoice(array('choices' => array($this->getObject()->get('tac_id')), 'empty_value' => $this->getObject()->get('tac_id'), 'required' => false)),
      'tac_prj_id'           => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('projet'))),
      'tac_parent_id'        => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('tache_pere'), 'required' => false)),
      'tac_cat_id'           => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('categorie'))),
      'tac_user_id'          => new sfValidatorInteger(array('required' => false)),
      'tac_libelle'          => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'tac_description'      => new sfValidatorString(array('max_length' => 2048, 'required' => false)),
      'tac_urgence'          => new sfValidatorInteger(array('required' => false)),
      'tac_date_debut'       => new sfValidatorDate(array('required' => false)),
      'tac_date_echeance'    => new sfValidatorDate(array('required' => false)),
      'tac_date_fin'         => new sfValidatorDate(array('required' => false)),
      'tac_charge_estimee'   => new sfValidatorNumber(array('required' => false)),
      'tac_charge_consommee' => new sfValidatorNumber(array('required' => false)),
      'tac_charge_restante'  => new sfValidatorNumber(array('required' => false)),
      'tac_etat'             => new sfValidatorInteger(array('required' => false)),
      'tac_termine'          => new sfValidatorBoolean(array('required' => false)),
      'created_at'           => new sfValidatorDateTime(),
      'updated_at'           => new sfValidatorDateTime(),
    ));

    $this->widgetSchema->setNameFormat('tache[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'tache';
  }

}
